/**
  ******************************************************************************
  * Copyright(c) 2018-2023 WUHAN LEADOR All rights reserved. 
  * - Filename    
  * - Author  Vincent
  * - Version V1.0.0
  * - Date    2019/4/16
  * - Brief   
  * - FunctionList:
  ******************************************************************************
  * History:
  *   
  *
  * 
  ******************************************************************************
*/

/* Includes ------------------------------------------------------------------*/
#include "event_pool.h"
#include "stdio.h"
#include "stdlib.h"
/* prama define discrible -----------------------------------------------------*/

/* strcuct  discrible --------------------------------------------------------*/

/* prama  discrible ---------------------------------------------------------*/

/* private fucntion  declaration --------------------------------------------*/
struct epoll_event *events;
/* private fucntion  discrible -----------------------------------------------*/
/*------------------------------------ ----------------------------------------
- @Name:  
- @Discrible:   
- @Param:  
- @Return:   
- @Others: 
------------------------------------ ----------------------------------------
- @Recode    date       version	        author             modify 
-          ------------------------------------------------------------------
-          20190416      V1.0          VINCENT            Create
- 
------------------------------------ ----------------------------------------*/
int ep_create(int flags)
{
    int fd = epoll_create1(flags);
   // check(fd > 0, "ep_create: epoll_create1");

    events = (struct epoll_event *)malloc(sizeof(struct epoll_event) * MAXEVENTS);
   // check(events != NULL, "ep_create: malloc");
    return fd;
}

/******************************************************************************
* @Function:  
* @Discrible:   
* @Param:  
* @Return:   
* @Others: 
******************************************************************************
* @Recode    date       version	        author             modify 
*          ------------------------------------------------------------------
*          20190416      V1.0          VINCENT            Create
* 
*******************************************************************************/
void ep_add(int epfd, int fd, struct epoll_event *event)
{
    int rc = epoll_ctl(epfd, EPOLL_CTL_ADD, fd, event);
   // check(rc == 0, "ep_add: epoll_ctl");
    return;
}

/******************************************************************************
* @Function:  
* @Discrible:   
* @Param:  
* @Return:   
* @Others: 
******************************************************************************
* @Recode    date       version	        author             modify 
*          ------------------------------------------------------------------
*          20190416      V1.0          VINCENT            Create
* 
*******************************************************************************/
void ep_mod(int epfd, int fd, struct epoll_event *event)
{
    int rc = epoll_ctl(epfd, EPOLL_CTL_MOD, fd, event);
   // check(rc == 0, "ep_mod: epoll_ctl");
    return;
}

/******************************************************************************
* @Function:  
* @Discrible:   
* @Param:  
* @Return:   
* @Others: 
******************************************************************************
* @Recode    date       version	        author             modify 
*          ------------------------------------------------------------------
*          20190416      V1.0          VINCENT            Create
* 
*******************************************************************************/
void ep_del(int epfd, int fd, struct epoll_event *event)
{
    int rc = epoll_ctl(epfd, EPOLL_CTL_DEL, fd, event);
  //  check(rc == 0, "ep_del: epoll_ctl");
    return;
}

/******************************************************************************
* @Function:  
* @Discrible:   
* @Param:  
* @Return:   
* @Others: 
******************************************************************************
* @Recode    date       version	        author             modify 
*          ------------------------------------------------------------------
*          20190416      V1.0          VINCENT            Create
* 
*******************************************************************************/
int ep_wait(int epfd, struct epoll_event *events, int maxevents, int timeout)
{
    int n = epoll_wait(epfd, events, maxevents, timeout);
  //  check(n >= 0, "ep_wait: epoll_wait");
    return n;
}


/************************ (.cpp) END OF FILE ************************************/